<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function f(x) {
            var zs = x.maxLength-x.value.length;
            document.getElementById("xz").innerHTML="还能输入:"+zs+"字";
        }
    </script>
</head>
<body>
自我介绍:
<br/>
<textarea maxlength="500" onkeyup="f(this)"></textarea>
<br/>
<span id="xz">还能输入:500字</span>
</body>
</html>